# -*- coding: utf-8 -*-
"""
Created on Fri Aug 12 20:29:07 2016

@author: WangHaiTao
"""
from scipy.integrate import odeint
import numpy as np

def lorenz(w,t,p,r,b):
    #给出矢量w，以及三个参数p,r,b计算出dx/dt,dy/dt,dz/dt的值
    x,y,z=w.tolist()
    #直接与lorenz的公式对应
    return p*(y-x),x*(r-z)-y,x*y-b*z
t=np.arange(0,30,0.01)#创建时间点
#调用ode对lorenz进行求解，用来个那个不同的初始值
track1=odeint(lorenz,(0.0,1.00,0.0),t,args=(10.0,28.0,3.0))
track2=odeint(lorenz,(0.0,1.01,0.0),t,args=(10.0,28.0,3.0))
#绘图
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt

fig=plt.figure()
ax=Axes3D(fig)
ax.plot(track1[:,0],track1[:,1],track1[:,2])
ax.plot(track2[:,0],track2[:,1],track2[:,2])
plt.show()